﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminSite.Master" AutoEventWireup="true" CodeBehind="NotificationsPage.aspx.cs" Inherits="Agents.Admin.NotificationsPage" %>
<asp:Content ID="Header" ContentPlaceHolderID="Header" runat="server">
	<script src="../Scripts/Common.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
	<h1>
		צפיה בהתראות
	</h1>            
	<hr />  
	 
	<h2>התראות על חוסר במלאי</h2>
	<asp:DataGrid runat="server" ID="dgLackNotifications" AutoGenerateColumns="False"
		AllowPaging="True" PageSize="12" PagerStyle-Mode="NumericPages" 
		DataSourceID="SqlDataSource1" BackColor="White" BorderStyle="None" 
		CellPadding="3" GridLines="Both"
		onpageindexchanged="dgLackNotifications_PageIndexChanged" 
		CssClass="dataGrid" Font-Names="Verdana" BorderColor="#999999" BorderWidth="1px">
		<AlternatingItemStyle BackColor="#DCDCDC" />
		<Columns>
			<asp:BoundColumn DataField="NotificationId" Visible="false" />
			<asp:BoundColumn DataField="ProductId" Visible="false" />
			<asp:BoundColumn DataField="Date" HeaderText="תאריך ההתראה" ItemStyle-Wrap="false" HeaderStyle-Wrap="false"/>
			<asp:BoundColumn DataField="Name" HeaderText="מוצר" ItemStyle-Wrap="false" HeaderStyle-Wrap="false"/>
			<asp:BoundColumn DataField="ItemsInStock" HeaderText="פריטים במלאי" ItemStyle-Wrap="false" HeaderStyle-Wrap="false"/>
			<asp:BoundColumn DataField="Threshold" HeaderText="סף מינימום לפריטים במלאי" ItemStyle-Wrap="false" HeaderStyle-Wrap="false"/>
			<asp:HyperLinkColumn Text="..." DataNavigateUrlField="NotificationId"
									DataNavigateUrlFormatString="javascript:PopupCenter('NotificationDetails.aspx?notificationId={0}','מערכת סוכנים',420, 220, true);"/>
		</Columns>
		<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
		<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
		<ItemStyle BackColor="White" ForeColor="Black" />
		<PagerStyle Mode="NumericPages" BackColor="#999999" ForeColor="Black" 
		HorizontalAlign="Center"></PagerStyle>
		<SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
	</asp:DataGrid>
	<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
		ConnectionString="<%$ ConnectionStrings:AgentConnectionString %>" 
		SelectCommand="SELECT	Notifications.Id AS NotificationId, Products.Id AS ProductId, Products.Name, 
								Products.ItemsInStock, Products.Threshold, Notifications.Date
						FROM Notifications LEFT JOIN Products
						ON (Notifications.ProductId = Products.Id)
						WHERE (NotificationType = 1)
						ORDER BY Date DESC">
	</asp:SqlDataSource>
	<br />      
	<h2>התראות על מלאי מת</h2>
	<asp:DataGrid runat="server" ID="dgDeadStockNotifications" AutoGenerateColumns="False"
		AllowPaging="True" PageSize="12" PagerStyle-Mode="NumericPages" 
		DataSourceID="SqlDataSource2" BackColor="White" BorderStyle="None" 
		CellPadding="3" GridLines="Both"
		onpageindexchanged="dgDeadStockNotifications_PageIndexChanged" 
		CssClass="dataGrid" Font-Names="Verdana" BorderColor="#999999" BorderWidth="1px">
		<AlternatingItemStyle BackColor="#DCDCDC" />
		<Columns>
			<asp:BoundColumn DataField="NotificationId" Visible="false" />
			<asp:BoundColumn DataField="ProductId" Visible="false" />
			<asp:BoundColumn DataField="Date" HeaderText="תאריך ההתראה" ItemStyle-Wrap="false" HeaderStyle-Wrap="false"/>
			<asp:BoundColumn DataField="Name" HeaderText="מוצר" ItemStyle-Wrap="false" HeaderStyle-Wrap="false"/>
			<asp:BoundColumn DataField="LastOrderDate" HeaderText="הזמנה אחרונה" ItemStyle-Wrap="false" HeaderStyle-Wrap="false"/>
			<asp:BoundColumn DataField="MaxDaysFromLastOrder" HeaderText="מס' ימים מקסימלי מההזמנה האחרונה" ItemStyle-Wrap="false" HeaderStyle-Wrap="false"/>
			<asp:HyperLinkColumn Text="..." DataNavigateUrlField="NotificationId"
									DataNavigateUrlFormatString="javascript:PopupCenter('NotificationDetails.aspx?notificationId={0}','מערכת סוכנים',420, 220, true);"/>
		</Columns>
		<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
		<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
		<ItemStyle BackColor="White" ForeColor="Black" />
		<PagerStyle Mode="NumericPages" BackColor="#999999" ForeColor="Black" 
		HorizontalAlign="Center"></PagerStyle>
		<SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
	</asp:DataGrid>
	<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
		ConnectionString="<%$ ConnectionStrings:AgentConnectionString %>" 
		SelectCommand="SELECT	Notifications.Id AS NotificationId, Products.Id AS ProductId, Products.Name, 
								Products.LastOrderDate, Products.MaxDaysFromLastOrder, Notifications.Date
						FROM Notifications LEFT JOIN Products
						ON (Notifications.ProductId = Products.Id)
						WHERE (NotificationType = 2)
						ORDER BY Date DESC">
	</asp:SqlDataSource>    
	
	<br />      
	<h2>התראות מבוססות מיקום</h2>
	<asp:DataGrid runat="server" ID="dgLocationBasedNotifications" AutoGenerateColumns="False"
		AllowPaging="True" PageSize="12" PagerStyle-Mode="NumericPages" 
		DataSourceID="SqlDataSource3" BackColor="White" BorderStyle="None" 
		CellPadding="3" GridLines="Both"
		onpageindexchanged="dgLocationBasedNotifications_PageIndexChanged" 
		CssClass="dataGrid" Font-Names="Verdana" BorderColor="#999999" BorderWidth="1px">
		<AlternatingItemStyle BackColor="#DCDCDC" />
		<Columns>
			<asp:BoundColumn DataField="Id" Visible="false" />
			<asp:BoundColumn DataField="Address" HeaderText="כתובת" />
			<asp:BoundColumn DataField="Content" HeaderText="תוכן ההתראה"/>
		</Columns>
		<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
		<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
		<ItemStyle BackColor="White" ForeColor="Black" />
		<PagerStyle Mode="NumericPages" BackColor="#999999" ForeColor="Black" 
		HorizontalAlign="Center"></PagerStyle>
		<SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
	</asp:DataGrid>
	<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
		ConnectionString="<%$ ConnectionStrings:AgentConnectionString %>" 
		SelectCommand="SELECT	Id, Content, Address 
						FROM LocationBasedNotifications">
	</asp:SqlDataSource>   
	<br />           
	<hr />
	<div class="alignCenter">               
		<asp:Button ID="backBtn" Text="חזור" runat="server" onclick="backBtn_Click" CssClass="button" />
	</div>
</asp:Content>
